import request from '@/utils/request'

// 创建仓库库位
export function createLocation(data) {
  return request({
    url: '/stock/location/create',
    method: 'post',
    data: data
  })
}

// 更新仓库库位
export function updateLocation(data) {
  return request({
    url: '/stock/location/update',
    method: 'put',
    data: data
  })
}

// 删除仓库库位
export function deleteLocation(id) {
  return request({
    url: '/stock/location/delete?id=' + id,
    method: 'delete'
  })
}

// 获得仓库库位
export function getLocation(id) {
  return request({
    url: '/stock/location/get?id=' + id,
    method: 'get'
  })
}

// 获得仓库库位分页
export function getLocationPage(query) {
  return request({
    url: '/stock/location/page',
    method: 'get',
    params: query
  })
}

// 导出仓库库位 Excel
export function exportLocationExcel(query) {
  return request({
    url: '/stock/location/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 查询仓库库位列表（排除节点）
export function listLocationExcludeChild(id, warehouseId) {
  return request({
    url: '/stock/location/list/exclude?id=' + id + '&warehouseId=' + warehouseId,
    method: 'get'
  })
}

